<?php

	$title = elgg_view_title($vars['entity']->title);
	$title .= '<div style="float: right;">' .
			elgg_view('output/url', array(
					'href' => elgg_get_site_url() . 'action/climbia/deleteVia?guid=' . $vars['entity']->guid,
					'text' => '<span class="elgg-icon elgg-icon-delete"></span>',
					'is_action' => true,
					'is_trusted' => true,
			))
			. '</div>';
	$content .= elgg_view('output/longtext', array('value' => $vars['entity']->description));	
	$guid_sector = $vars['entity']->sector_guid;
	
	$entity = get_entity($guid_sector);
	
	$content .= "<h3>Pertenece al Sector: </h3>";
	$content .= '<h4>' . $entity->title . '</h4>';
	
//Likes de la via	
//////////////////////////////////////////////////////////////////////////////////
/*
	$object = $vars['entity'];
	
	$num_of_likes = $object->countAnnotations('likes');
	
	//if ($num_of_likes == 0) {
		//return true;
	//}
	
	$guid = $object->guid;
	
	$likes_button = elgg_view_icon('thumbs-up');
	
	// check to see if the user has already liked this
	if (elgg_is_logged_in() && $object->canAnnotate(0, 'likes')) {
		if (!elgg_annotation_exists($guid, 'likes')) {
			$likes_button = elgg_view('output/url', array(
				'href' => "action/likes/add?guid={$guid}",
				'text' => elgg_view_icon('thumbs-up'),
				'title' => elgg_echo('likes:likethis'),
				'is_action' => true,
			));
		} else {
			$likes = elgg_get_annotations(array(
				'guid' => $guid,
				'annotation_name' => 'likes',
				'owner_guid' => elgg_get_logged_in_user_guid()
			));
	
			$likes_button = elgg_view('output/url', array(
				'href' => "action/likes/delete?annotation_id={$likes[0]->id}",
				'text' => elgg_view_icon('thumbs-up-alt'),
				'title' => elgg_echo('likes:remove'),
				'is_action' => true,
			));
		}
	}
	
	// display the number of likes
	if ($num_of_likes == 1) {
		$likes_string = elgg_echo('likes:userlikedthis', array($num_of_likes));
	} else {
		$likes_string = elgg_echo('likes:userslikedthis', array($num_of_likes));
	}
	
	$likes_string = elgg_view('output/url', array(
		'text' => $likes_string,
		'title' => elgg_echo('likes:see'),
		'rel' => 'popup',
		'href' => "#likes-$guid"
	));
	
	$likes_list = elgg_list_annotations(array('guid' => $guid, 'annotation_name' => 'likes', 'limit' => 99));
	
	$likes_module = elgg_view_module('popup', 'Likes', $likes_list, array('class' => 'hidden elgg-likes-list', 'id' => "likes-$guid"));
	
	$vars['image'] = $likes_button;
	$vars['body'] = $likes_string . $likes_module;
	$vars['class'] = 'elgg-river-participation';
	
	$content .= elgg_view('page/components/image_block', $vars);
*/	
//////////////////////////////////////////////////////////////////////////////////
	
//Comentarios de la via		
//////////////////////////////////////////////////////////////////////////////////	
	$comments = $vars['entity']->getAnnotations('generic_comment');
	$comment_count = $vars['entity']->countComments();
	$content .= '<span class="elgg-river-comments-tab">' . elgg_echo('comments') . '</span>';
	
	$content .= elgg_view_annotation_list($comments , array('list_class' => 'elgg-river-comments'));
	
	if ($comment_count > count($comments)) {
		$num_more_comments = $comment_count - count($comments);
		$url = $vars['entity']->getURL();
		$params = array(
			'href' => $url,
			'text' => elgg_echo('river:comments:more', array($num_more_comments)),
			'is_trusted' => true,
		);
		$link = elgg_view('output/url', $params);
		$content .= "<div class=\"elgg-river-more\">{$link}</div>";
	}

	// inline comment form
	$form_vars = array('id' => "comments-add-{$vars['entity']->getGUID()}", 'class' => 'elgg-river-responses');
	$body_vars = array('entity' => $vars['entity'], 'inline' => true);
	$content .= elgg_view_form('comments/add', $form_vars, $body_vars);
	
//////////////////////////////////////////////////////////////////////////////////
	
	$content = elgg_view_module('info', $title, $content);
	
	echo elgg_view_layout('one_sidebar', array(
           'content' => $content,
           'sidebar' => $sidebar
        ));